import React from 'react';
import Child from './Child';

export class Parent extends React.Component {
  constructor() {
    super();
    this.state = {
      lastName: '王',
    };
  }

  render() {
    return (
      <div style={{ border: '1px solid red', padding: 24 }}>
        <h2>我是父组件，我姓：{this.state.lastName}</h2>
        <Child
          lastName={this.state.lastName}
          age={18}
          hobbies={['吃饭', '睡觉', '敲代码']}
          obj={{ name: 'Rose', age: 18 }}
          fn={(arg) => <h1>{arg.split('').reverse()}</h1>}
          jsx={<h2 onClick={() => console.log(123)}>传入的JSX</h2>}
        />
      </div>
    );
  }
}

export default Parent;
